test: add expectTypeOf coverage for src/* type exports#151
Merged
Conversation
Enables Vitest's typecheck runner (scoped to tests/unit/**/*.test-d.ts) so it runs alongside the regular suite via `vitest run`, and adds type-level assertions for every exported type/signature in src/*: the intersect action, intersectAttachment, createIntersectionGroup, createIntersectionObserver, and both components' prop/bindable shapes.
render
Bot
temporarily deployed
to
metonym/fix-svelte-import-alias - svelte-intersection-observer PR #151
July 5, 2026 19:36
Destroyed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a type-level test suite (tests/unit/types.test-d.ts) that uses Vitest's expectTypeOf to assert on every exported type and function signature from src/*: IntersectActionOptions, IntersectGroupSharedOptions, IntersectGroupNodeOptions, IntersectionGroup, the intersect action, intersectAttachment, createIntersectionGroup, IntersectionObserverState, createIntersectionObserver, and the props/bindings of both the IntersectionObserver and MultipleIntersectionObserver components. Imports use the real package subpaths (e.g. svelte-intersection-observer/IntersectionObserver.svelte) via the existing tsconfig path mapping, rather than relative paths into src.
vitest.config.ts now enables typecheck, scoped to tests/unit/**/*.test-d.ts, so these run alongside the regular suite in a single vitest run/test:unit invocation with no separate command needed.
Low risk: this only adds a new test file and a scoped config option. The main thing to watch is that the typecheck runner adds a bit of extra time to test:unit (a few seconds, spawns tsc), and that future changes to the public type exports will now fail CI if they drift from these assertions, which is the intended effect.